(function(){
	'use strict';

    var app = angular.module('myApp.i18n-module');
	
    app.filter( 't', function( $window, i18nService ) {
    	return function( key, $scope ) {
    		if( $scope.domain === undefined || $scope.domain == '' ){ console.log( "Domain not defined" ); return key; }
    		
    		var i18n = angular.fromJson( $window.sessionStorage['i18n'] );
    		if( i18n == undefined ) return key;
    		if( i18n[$scope.domain] == undefined ) return key;
    		return i18n[$scope.domain][key] === undefined ? key : i18n[$scope.domain][key];
    	};
    } );
    
})();